Line clipping methods and algorithms are well known in the field of computer graphics. In computer graphics, clipping refers to an optimization step where only portions of the vector or raster image that are visible to the user are drawn. This can save processing time, on parts of the image that do not fall into any visible region of the display. For 2D vector graphics data such as polygons and lines, clipping consists of deciding which of the vector data would be completely visible or completely invisible or partially visible. For the former two cases, the system either completely draws or throws away the respective geometry and for the partially visible case the geometry is ‘cut’ such that only the visible portion is drawn. For example, a line segment is intersected with the visible boundary of the display to come up with a shorter line segment that is completely contained within the bounds of the display. Hence clipping is used to accelerate the time taken to render graphics to the display.
Well known line clipping methods include the Cohen-Sutherland method, in which, for rectangular windows, the four edges of the clip window are extended, and nine regions are created from their intersection, of which only the middle region (viewport) is visible. The Cohen-Sutherland method includes, excludes or partially includes lines based on the regions in which the endpoints lie. The Liang-Barsky line clipping method is another popular line clipping algorithm. It uses the parametric equation of a line and inequalities describing the range of the clipping window to determine the intersections between the line and the clipping rectangle. While these methods are effective, they still require significant computational resources and time to render each new frame. This is of particular concern in mobile devices where new and more powerful graphics applications are being deployed, and where computational resources and power usage are at a premium.
It is, therefore, desirable to provide a method and system of clipping lines that is quicker and less computationally intensive than previously known methods.